import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:musicapp/model/recommend.dart';
import 'package:musicapp/pages/daily_songs/daily_songs_page.dart';
import 'package:musicapp/pages/home/home_page.dart';
import 'package:musicapp/pages/login_page.dart';
import 'package:musicapp/pages/play_list/play_list_page.dart';
import 'package:musicapp/pages/play_songs/play_songs_page.dart';
import 'package:musicapp/pages/splash_page.dart';
import 'package:musicapp/pages/top_list/top_list_page.dart';
import 'package:musicapp/utils/fluro_convert_utils.dart';

/// splash 页面
var splashHandler = new Handler(
    handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  return SplashPage();
});

/// 登录页
var loginHandler = new Handler(
    handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  return LoginPage();
});

/// 主页
var homeHandler = new Handler(
    handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  return HomePage();
});

/// 每日推荐
var dailySongsHandler = new Handler(
    handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  return DailySongsPage();
});

/// 歌单
var playListHandler = new Handler(
    handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  String data = params['data'].first;
  return PlayListPage(Recommend.fromJson(FluroConvertUtils.string2map(data)));
});

/// 排行榜
var topListHandler = new Handler(
    handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  return TopListPage();
});

/// 播放歌单
var playSongHandler = new Handler(
    handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  return PlaySongsPage();
});
